package com.csh.szhm.adapter;

import com.csh.szhm.R;
import com.csh.szhm.module.search.SzhmSearchBean;
import com.csh.szhm.module.search.SzhmSearchItemBean;
import com.csh.szhm.module.search.SzhmSearchTypeBean;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

public class SzhmSelectTypeLeftAdapter extends MyBaseAdapter<SzhmSearchTypeBean> {

	public SzhmSelectTypeLeftAdapter(Context c) {
		super(c);
		// TODO Auto-generated constructor stub
	}

	public int mSelectPostion;

	public void setSelectPosition(int pos) {
		this.mSelectPostion = pos;
		notifyDataSetChanged();
	}
//	public int count=10;
//	@Override
//	public int getCount() {
//		// TODO Auto-generated method stub
//		return count;
//	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		HolderView holderView = null;
		if (convertView == null) {
			holderView = new HolderView();
			convertView = mLayoutInflater.inflate(
					R.layout.szhm_sort_area_item_left_layout, null);
			holderView.txt = (TextView) convertView
					.findViewById(R.id.area_txt_ix);
			convertView.setTag(holderView);
		} else {
			holderView = (HolderView) convertView.getTag();
		}
		if(mSelectPostion==position){
			holderView.txt .setBackgroundColor(mContext.getResources().getColor(android.R.color.white));
		}else{
			holderView.txt .setBackgroundColor(mContext.getResources().getColor(android.R.color.transparent));
		}
		holderView.txt.setText(mData.get(position).getName());
		return convertView;
	}

	private class HolderView {
		TextView txt;
	}
}
